<template>
    <div class="common-layout">
        <el-container>
            <el-aside width="200px">
                <el-menu router active-text-color="#ffd04b" background-color="#545c64" class="el-menu-vertical-demo"
                    default-active="2" text-color="#fff">
                    <!-- 二级路由 -->
                    <el-menu-item :index="item.auth_path" v-for="item in acl" v-show="item.children.length == 0">
                        <el-icon><icon-menu /></el-icon>
                        <span>{{item.auth_name}}</span>
                    </el-menu-item>

                    <el-sub-menu :index="item.auth_path" v-for="item in acl" v-show="item.children.length != 0">
                        <template #title>
                            <el-icon>
                                <location />
                            </el-icon>
                            <span>{{item.auth_name}}</span>
                        </template>

                        <el-menu-item :index="child.auth_path" v-show="child.is_nav == 1" v-for="child in item.children">
                            <el-icon><icon-menu /></el-icon>
                            <span>{{child.auth_name}}</span>
                        </el-menu-item>
                    </el-sub-menu>
                </el-menu>
            </el-aside>
            <el-container>
                <el-header>Header</el-header>
                <el-main>
                    <router-view></router-view>
                </el-main>
            </el-container>
        </el-container>
    </div>
</template>
<script setup>

import {
  Document,
  Menu as IconMenu,
  Location,
  Setting,
} from '@element-plus/icons-vue'

const acl = JSON.parse(localStorage.getItem('acl'));
console.log(acl);

</script>

<style scoped lang='scss'>
.common-layout,
.el-aside,
.el-container {
    height: 100%;
}
.el-menu{
    height: 100%;
}
</style>